package com.makinolo.rlvforge.tacx.data
{
	import flash.utils.ByteArray;

public class ProgramData implements Persistent
{
	private static const DEFAULT_FRICTION:Number = 4.0;	
	public static const RECORD_SIZE:int = 12;
	
	// Class members
	private var DurationDistance:Number;	//Seconds or metres, depending on program type
	private var PulseSlopeWatts:Number;	//Pulse, slope or watts data, depending on program type
	private var RollingFriction:Number;	// Usually 4.0
		
	public function ProgramData(durationDistance:Number, pulseSlopeWatts:Number, rollingFriction:Number = DEFAULT_FRICTION)
	{
		super();
		DurationDistance = durationDistance;
		PulseSlopeWatts = pulseSlopeWatts;
		RollingFriction = rollingFriction;
	}

/*	public function ProgramData(LEDataInputStream dis) throws IOException  
	{
		DurationDistance = dis.readFloat(); 
		PulseSlopeWatts = dis.readFloat();
		RollingFriction = dis.readFloat();
	}*/
	
	public function getDurationDistance():Number
	{
		return DurationDistance;
	}
	public function setDurationDistance(durationDistance:Number):void
	{
		DurationDistance = durationDistance;
	}
	public function getPulseSlopeWatts():Number
	{
		return PulseSlopeWatts;
	}
	public function setPulseSlopeWatts(pulseSlopeWatts:Number):void
	{
		PulseSlopeWatts = pulseSlopeWatts;
	}
	public function getRollingFriction():Number
	{
		return RollingFriction;
	}
	public function setRollingFriction(rollingFriction:Number):void
	{
		RollingFriction = rollingFriction;
	}
	
	public function persist(dos:ByteArray):void
	{
		dos.writeFloat(DurationDistance); 
		dos.writeFloat(PulseSlopeWatts);
		dos.writeFloat(RollingFriction);
	}
}

}